home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / bsd / netinet / bootp.h next >
C/C++ Source or Header  |  1995-02-14  |  3KB  |  107 lines

  1. /*
  2.  * Bootstrap Protocol (BOOTP).  RFC 951.
  3.  */
  4. /*
  5.  * HISTORY
  6.  *
  7.  * 14 May 1992 David E. Bohman at NeXT
  8.  *    Added correct padding to struct nextvend.  This is
  9.  *    needed for the i386 due to alignment differences wrt
  10.  *    the m68k.  Also adjusted the size of the array fields
  11.  *    because the NeXT vendor area was overflowing the bootp
  12.  *    packet.
  13.  */
  14.  
  15. #define iaddr_t struct in_addr
  16.  
  17. struct bootp {
  18.     u_char    bp_op;        /* packet opcode type */
  19. #define    BOOTREQUEST    1
  20. #define    BOOTREPLY    2
  21.     u_char    bp_htype;    /* hardware addr type */
  22.     u_char    bp_hlen;    /* hardware addr length */
  23.     u_char    bp_hops;    /* gateway hops */
  24.     u_long    bp_xid;        /* transaction ID */
  25.     u_short    bp_secs;    /* seconds since boot began */    
  26.     u_short    bp_unused;
  27.     iaddr_t    bp_ciaddr;    /* client IP address */
  28.     iaddr_t    bp_yiaddr;    /* 'your' IP address */
  29.     iaddr_t    bp_siaddr;    /* server IP address */
  30.     iaddr_t    bp_giaddr;    /* gateway IP address */
  31.     u_char    bp_chaddr[16];    /* client hardware address */
  32.     u_char    bp_sname[64];    /* server host name */
  33.     u_char    bp_file[128];    /* boot file name */
  34.     u_char    bp_vend[64];    /* vendor-specific area */
  35. };
  36.  
  37. /*
  38.  * UDP port numbers, server and client.
  39.  */
  40. #define    IPPORT_BOOTPS        67
  41. #define    IPPORT_BOOTPC        68
  42.  
  43. /*
  44.  * "vendor" data permitted for Stanford boot clients.
  45.  */
  46. struct vend {
  47.     u_char    v_magic[4];    /* magic number */
  48.     u_long    v_flags;    /* flags/opcodes, etc. */
  49.     u_char    v_unused[56];    /* currently unused */
  50. };
  51. #define    VM_STANFORD    "STAN"    /* v_magic for Stanford */
  52.  
  53. /* v_flags values */
  54. #define    VF_PCBOOT    1    /* an IBMPC or Mac wants environment info */
  55. #define    VF_HELP        2    /* help me, I'm not registered */
  56.  
  57. #define    NVMAXTEXT    55    /* don't change this, it just fits RFC951 */
  58. struct nextvend {
  59.     u_char nv_magic[4];    /* Magic number for vendor specificity */
  60.     u_char nv_version;    /* NeXT protocol version */
  61.     /*
  62.      * Round the beginning
  63.      * of the union to a 16
  64.      * bit boundary due to
  65.      * struct/union alignment
  66.      * on the m68k.
  67.      */
  68.     unsigned short    :0;    
  69.     union {
  70.         u_char NV0[58];
  71.         struct {
  72.             u_char NV1_opcode;    /* opcode - Version 1 */
  73.             u_char NV1_xid;    /* transcation id */
  74.             u_char NV1_text[NVMAXTEXT];    /* text */
  75.             u_char NV1_null;    /* null terminator */
  76.         } NV1;
  77.     } nv_U;
  78. };
  79. #define    nv_unused    nv_U.NV0
  80. #define    nv_opcode    nv_U.NV1.NV1_opcode
  81. #define    nv_xid        nv_U.NV1.NV1_xid
  82. #define    nv_text        nv_U.NV1.NV1_text
  83. #define nv_null        nv_U.NV1.NV1_null
  84.  
  85. /* Magic number */
  86. #define VM_NEXT        "NeXT"    /* v_magic for NeXT, Inc. */
  87.  
  88. /* Opcodes */
  89. #define    BPOP_OK        0
  90. #define BPOP_QUERY    1
  91. #define    BPOP_QUERY_NE    2
  92. #define    BPOP_ERROR    3
  93.  
  94. struct bootp_packet {
  95.     struct ip bp_ip;
  96.     struct udphdr bp_udp;
  97.     struct bootp bp_bootp;
  98. };
  99.  
  100. #define    BOOTP_PKTSIZE (sizeof (struct bootp_packet))
  101.  
  102. /* backoffs must be masks */
  103. #define    BOOTP_MIN_BACKOFF    0x7ff        /* 2.048 sec */
  104. #define    BOOTP_MAX_BACKOFF    0xffff        /* 65.535 sec */
  105. #define    BOOTP_RETRY        6        /* # retries */
  106.  
  107.